package string;

public class Test {
    public static void main(String[] args) {
        String s1 = "www.tedu.cn";
        String s2 = "https://www.tarena.com.cn";
        String name1 = getHostName(s1);
        String name2 = getHostName(s2);
        System.out.println(name1);
        System.out.println(name2);

    }
    public static String getHostName(String url){
        int a = url.indexOf(".");
        int b = url.indexOf(".",a+1);
        return url.substring(a+1,b);

    }
}
